#include <stdlib.h>

#include "lib.h"
#include "cdrawsql.h"
#include "CSavedGame.h"
#include "odbc.h"
#include "missinggamenums.h"
#include "opts.h"
#include "hand.h"
#include "cdrawgame.h"
#include "cdrawhand.h"
#include "stdncerr.h"

#include "memory.h"


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::CDrawSQL(ProgressiveTrackSQL *pTracker, CInfo *pInfo)
///
/// @param  pTracker    pointer to this server's tracker object...used to get connections to the database.
/// @param  pInfo       object that holds info on the players session...created during the login process.
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
CDrawSQL::CDrawSQL(ProgressiveTrackSQL *pTracker, CInfo *pInfo) : CDBInterface(pTracker, pInfo)
{
#ifdef USE_MISSINGGAMENUMS
	//missing game nums deleted in TrackSQL::~TrackSQL
	missinggamenums = new MissingGameNums(this, "pub_getTableIdentityCDrawPoker");
#endif
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::createGame(int32 casinoId, const PID& pid, bool8 forMoney, SESSIONID sessionId, 
///                                int32 compFactor, CPokerGameID gid, int32 bet, int32 progressiveBet,
///                                int32 multiBankBet, int32* balance, int32* comp, uint8 payTable)
//
/// Creates database records for a new Caribbean Draw game.
///
/// @param  casinoID        (in)
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  sessionId       (in)  unique identifier for the player's current session
/// @param  compFactor      (in)
/// @param  gid             (out) unique identifier for this current game that we're about to create
/// @param  bet             (in)  
/// @param  progressiveBet  (in)
/// @param  multiBankBet    (in) 
/// @param  balance         (out) user's balance after making this bet.
/// @param  comp            (out)
/// @param  payTable        (in)  which paytable setting the casino is using.
///
/// @return int32            TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::createGame(int32 casinoId,
	const PID& pid, bool8 forMoney, SESSIONID sessionId, int32 compFactor,
	CPokerGameID gid, int32 bet, int32 progressiveBet,
	int32 multiBankBet, int32* balance, int32* comp, uint8 payTable)
{
	ODBCConnection* conn;
	ODBCQuery* query;
	bool8 ok = false;

	conn = m_pTracker->getConn();
	if (!conn)
        return TrackSQL::NoConnection;

	query = conn->query();
	if (query)
	{
		query->define("exec pub_CreateGameCDPoker ");
		query->addParam(casinoId);
		query->addParam(pid);
		query->addParam((bool8)(forMoney != 0));
		query->addParam(sessionId, ODBCQuery::NOQUOTES);
		query->addParam(compFactor);
		query->addParam(bet, ODBCQuery::MONEY);
		query->addParam(progressiveBet, ODBCQuery::MONEY);
		query->addParam(multiBankBet, ODBCQuery::MILLIMONEY);
		query->addParam(payTable);

		if (query->exec())
		{
			while (query->getRow())
			{
				ok =
					query->getData(1, gid, CPOKER_GAMEID_SIZE) &&
					query->getData(2, balance, ODBCQuery::MONEY) &&
					query->getData(3, comp);
			}
		}
		delete query;
	}
	delete conn;

	if (ok)
	{
		#ifdef USE_MISSINGGAMENUMS
		int32 gamenum = atol(gid);
		if (missinggamenums)
				missinggamenums->setGameNum(gamenum);
		#endif
	}

	return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::deal(const PID& pid, CPokerGameID gid, int32 nDeckSeed, int32 numDealer, uint8* dealer,
///                          int32 numPlayer, uint8* player);
///                        
///
/// Records information in the database about the cards just dealt and ties that info to the current game.
///
/// @param  pid             (in)  unique id of current player
/// @param  gid             (in)  unique id of current hand for this hand of Draw
/// @param  nDeckSeed       (in)  the seed we can use to recreate the shoe in the case of re-entering a saved game.
/// @param  numDealer       (in)  number of dealer cards
/// @param  dealer          (in)  dealer cards
/// @param  numPlayer       (in)  number of player cards
/// @param  player          (in)  player cards
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::deal(const PID& pid, CPokerGameID gid, int32 nDeckSeed,
               int32 numDealer, uint8* dealer, int32 numPlayer, uint8* player)
{
	ODBCConnection* conn;
	ODBCQuery* query;
	bool8 ok = false;

	conn = m_pTracker->getConn();
	if (!conn)
		return TrackSQL::NoConnection;

	query = conn->query();
	if (query)
	{
		query->define("exec pub_CDPokerDeal ");
		query->addParam(pid);
		query->addParam(gid, ODBCQuery::NOQUOTES);
		query->addParam(nDeckSeed);
		query->addParam(dealer, numDealer, ODBCQuery::BINARY);
		query->addParam(player, numPlayer, ODBCQuery::BINARY);

		if (query->exec())
		{
			ok = true;

			while (query->getRow())
				/* ignore */ ;
		}
		delete query;
	}
	delete conn;

	return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::gameDone(int32 casinoId, const PID& pid, bool8 forMoney, CPokerGameID gid, 
///                              bool8 raised, int32 payAnte, int32 payRaise, int32 payProgressive, 
///                              int32 payMultiBank, int32 outcome, int32 balanceAdjust, 
///                              int32* balance, int32* comp, bool8 bMalfunction,
///                              int32 numDealer, uint8* dealer, int32 numPlayer, uint8* player,
//                               uint8* player, uint8 ucDealerDraw, uint8 ucPlayerDraw)
///
/// Records information in the database about the outcome of the game that the user just played.
///
/// @param  casinoID        (in)
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  gid             (in)  unique identifier for this current hand of Draw
/// @param  raised          (in)  Did the user raise or fold?
/// @param  payAnte         (in)  How much did the user win OR lose off of the ante
/// @param  payRaise        (in)  How much did the user win OR lose off of the call.
/// @param  payMultiBank    (in)  How much (if anything) did the user win on the progressive?
/// @param  outcome         (in)  who won?
/// @param  balanceAdjust   (in)  Total amount won or lost by the user.
/// @param  balance         (out) user's balance after this game.
/// @param  comp            (out)
/// @param  bMalfunction    (in)  True if the user won a big progressive jackpot on this game.
/// @param  numDealer       (in)  number of dealer cards
/// @param  dealer          (in)  dealer cards
/// @param  numPlayer       (in)  number of player cards
/// @param  player          (in)  player cards
/// @param  ucDealerDraw    (in)  how many cards the dealer drew
/// @param  ucPlayerDraw    (in)  how many cards the player drew
///
/// @return int32            TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::gameDone(int32 casinoId,
	const PID& pid, bool8 forMoney, CPokerGameID gid, bool8 raised,
	int32 payAnte, int32 payRaise, int32 payProgressive, int32 payMultiBank,
	int32 outcome, int32 balanceAdjust, int32* balance, int32* comp, bool8 bMalfunction,
    int32 numDealer1, uint8* dealer1, int32 numDealer2, uint8* dealer2, int32 numPlayer, 
    uint8* player, uint8 ucDealerDraw, uint8 ucPlayerDraw)
{
	ODBCConnection* conn;
	ODBCQuery* query;
	bool8 ok = false;

	conn = m_pTracker->getConn();
	if (!conn)
		return TrackSQL::NoConnection;

	query = conn->query();
	if (query)
	{
		query->define("exec pub_CDPokerGameDone ");
		query->addParam(casinoId);
		query->addParam(pid);
		query->addParam((bool8)(forMoney != 0));
		query->addParam(gid, ODBCQuery::NOQUOTES);
		query->addParam((raised ? "R" : "F"));
		query->addParam(payAnte, ODBCQuery::MONEY);
		query->addParam(payRaise, ODBCQuery::MONEY);
		query->addParam(payProgressive, ODBCQuery::MONEY);
		query->addParam(payMultiBank, ODBCQuery::MILLIMONEY);
		query->addParam((uint8)(outcome & 0xffL), ODBCQuery::BINARY);
		query->addParam(balanceAdjust, ODBCQuery::MONEY);
        query->addParam(bMalfunction);  // kharmon.  01-05-06.  #4250.  Did the player win a big progressive jackpot?

        // kharmon.  10-12-06.  #8226.  No longer save cards in database before the game is complete.
   		query->addParam(dealer1, numDealer1, ODBCQuery::BINARY);
        query->addParam(dealer2, numDealer2, ODBCQuery::BINARY);
		query->addParam(player, numPlayer, ODBCQuery::BINARY);
        query->addParam(ucDealerDraw);
        query->addParam(ucPlayerDraw);

		if (query->exec())
		{
			while (query->getRow())
			{
				ok = query->getData(1, balance, ODBCQuery::MONEY) &&
					query->getData(2, comp);
			}
		}
		delete query;
	}
	delete conn;

	return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn CDrawSQL::hasSavedGame(const PID& pid, bool8 forMoney, CPokerGameID gid,  
///                              CSavedGame* dest, bool8* exists)
/// 
/// Checks for unfinished Caribbean Draw games that this player might have laying around and if one is
/// found, returns the state information to the caller so that the game can be reincarnated.
///
/// @param  pid             (in)  unique identifier for the current player
/// @param  forMoney        (in)  is this session for fun or for money?
/// @param  gid             (in)  unique identifier for this current Draw game
/// @param  dest            (out) if a saved game is found, it's state info is returned in here.
/// @param  exists          (out) true if we found a saved game, false if not.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::hasSavedGame(const PID& pid, bool8 forMoney, CPokerGameID gid,
	                   CSavedGame* dest, bool8* exists)
{
	ODBCConnection* conn;
	ODBCQuery* query;
	bool8 ok = false;

	*exists = false;

	conn = m_pTracker->getConn();
	if (!conn)
		return TrackSQL::NoConnection;

	query = conn->query();
	if (query)
	{
		query->define("exec pub_CDPokerGetSavedGame ");
		query->addParam(pid);
		query->addParam((bool8)(forMoney != 0));

		if (query->exec())
		{
			int32 hasSaved = 0;

			ok = true;

			while (query->getRow())
			{
				if (query->getData(1, &hasSaved) && hasSaved)
				{
					*exists = true;

                    if(hasSaved==1)
                    {
                        // kharmon.  10-12-06.  #8226.  A game that only stored the deckseed.
                        dest->bHasDeckSeed = true;
					    query->getData(2, gid, CPOKER_GAMEID_SIZE);
					    query->getData(3, &dest->bet, ODBCQuery::MONEY);
					    query->getData(4, &dest->progressiveBet, ODBCQuery::MONEY);
					    query->getData(5, &dest->nDeckSeed);
                        query->getData(6, &dest->payTable);
                        query->getData(7, &dest->bMalfunction);     // kharmon.  01-05-06.  #4250.  Did the player win a big progressive jackpot during this game?
                    }
				}
			}
		}
		delete query;
	}
	delete conn;

	return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::saveGame(const PID& pid, bool8 forMoney, CPokerGameID gid, CSavedGame* src)
///
/// Could be used to store data for each game after the cards are dealt, for use by the restore operation.
/// BUT, in Draw's case, this happens in trackDeal, so nothing to do.  Just a place holder.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::saveGame(const PID& pid, bool8 forMoney, CPokerGameID gid,
	               CSavedGame* src)
{
	return true;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::getOptions(bool8* progressiveOn, uint8* progPayTable, 
///                                int32* progJackpotID, uint8* payTable)
///
/// Returns the specific setup options that the casino has selected for Caribbean Draw.
///
/// @param  progressiveOn       (out) enable progressive?
/// @param  progPayTable        (out) which set of payout numbers to use for progressive wins?
/// @param  progJackpotID       (out) 
/// @param  payTable            (out) which set of payout numbers should be used for normal wins?
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int32
CDrawSQL::getOptions(bool8* progressiveOn, uint8* progPayTable, 
                     int32* progJackpotID, uint8* payTable, int32* progressiveFixAmountMultiplier)
{
	ODBCConnection* conn;
	ODBCQuery* query;
	bool8 ok = false;
	uint8 bit1=0, bit2=0, tinyint=0;
	int32 int1=0, int2=0, int3=0;

	conn = m_pTracker->getConn();
	if (!conn)
		return TrackSQL::NoConnection;

	query = conn->query();
	if (query)
	{
		query->define("exec pub_CDPokerGetOptions ");

		if (query->exec())
		{
			while (query->getRow())
			{
				ok = query->getData(1, &bit1) &&
					 query->getData(2, &bit2) &&
                     query->getData(3, &tinyint)  &&
                     query->getData(4, &int1) &&
                     query->getData(5, &int2) &&
					 query->getData(6, &int3);

				if (ok)
				{
					*progressiveOn = (bool8)(bit1 != 0);
					*progPayTable = (uint8)tinyint;
					*progJackpotID = (int32)int1;
					*payTable = (uint8)(int2 & 0xff);
					*progressiveFixAmountMultiplier = int3;

                    if(*payTable<0 || *payTable>= CDrawGame::MAX_CDRAW_PAY_FREQUENCIES)
                    {
                        *payTable = 0;
                    }

                    if(*progPayTable<0 || *progPayTable>= CDrawGame::MAX_CDRAW_PROGRESSIVE_PAY_FREQUENCIES)
                    {
                        *progPayTable = 0;
                    }

				}
			}
		}
		delete query;
	}
	delete conn;

	return ok ? TrackSQL::NoError : TrackSQL::ExecFailed;
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackNewGame(int32 Bet, int32 ProgressiveBet, int32 multiBankBet, 
///                                  int32 *Balance, uint8 payTable, int32 compFactor)
///
/// Creates database records for a new Caribbean Draw game.
///
/// @param  Bet             (in)  
/// @param  ProgressiveBet  (in)
/// @param  multiBankBet    (in) 
/// @param  Balance         (out) user's balance after making this bet.
/// @param  payTable        (in)  which paytable setting the casino is using.
/// @param  compFactor      (in)
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackNewGame(int32 Bet, int32 ProgressiveBet, int32 multiBankBet, 
                       int32 *Balance, uint8 payTable, int32 compFactor)
{
	int32 result = TrackSQL::ExecFailed;
	int32 comp;

	if (m_pTracker && m_pInfo)
	{
		m_pTracker->lock();

		result = createGame(ServerOpts::casinoId,
			m_pInfo->pid, m_pInfo->forMoney, m_pInfo->sessionId,
			m_pInfo->forMoney ? compFactor : 0,
			m_pInfo->gid, Bet, ProgressiveBet, multiBankBet, Balance, &comp,
			payTable);

		m_pTracker->unlock();
	}

	return (bool8)(result == TrackSQL::NoError);
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackDeal(CGame *pGame)
///
/// Records information in the database about the cards just dealt and ties that info to the current game.
///
/// @param  numDealer       (in)  the game object that we're saving information about.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackDeal(CGame *pGame)
{
	int32 result = TrackSQL::ExecFailed;

	if (m_pTracker && m_pInfo)
	{
        CDrawGame *pDraw =  (CDrawGame *) pGame;

        CDrawHand *pDealer = pDraw->getDealerHand();
        CDrawHand *pPlayer = pDraw->getPlayerHand();

		m_pTracker->lock();

        // kharmon.  11-07-06.  #8226.  We want to write out the single faceup dealer 
        // card, but only that dealer card, so prepare a temp array that only shows that card, 
        // with zeros for the other cards.
        uint8 aucDealerCards[5];
        memset(aucDealerCards, 0, sizeof(aucDealerCards));
        aucDealerCards[4] =  pDealer->getCards()[4];

		result = deal(m_pInfo->pid, m_pInfo->gid, pDraw->getDeckSeed(),
			          5, aucDealerCards, pPlayer->getCount(), pPlayer->getCards());

		m_pTracker->unlock();
	}
	return (bool8)(result == TrackSQL::NoError);
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackGameDone(bool8 Raised, int32 PayAnte, int32 PayRaise, int32 PayProgressive,
///                                 int32 PayMultiBank, int32 Outcome, int32 BalAdjust, int32 *Balance,
///                                 int32 numDealer, uint8* dealer, int32 numPlayer, 
///                                 uint8* player, int32, uint8)
///
/// Records information in the database about the outcome of the game that the user just played.
///
/// @param  Raised          (in)  Did the user raise or fold?
/// @param  PayAnte         (in)  How much did the user win OR lose off of the ante
/// @param  PayRaise        (in)  How much did the user win OR lose off of the call.
/// @param  PayProgressive  (in)  How much (if anything) did the user win on the progressive?
/// @param  PayMultiBank    (in)
/// @param  Outcome         (in)  who won?
/// @param  BalAdjust       (in)  Total amount won or lost by the user.
/// @param  Balance         (out) user's balance after this game.
/// @param  bMalfunction    (in)  True if the user won a big progressive jackpot on this game.
/// @param  pGame           (in)  pointer to game object that we're recording data for
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackGameDone(bool8 Raised, int32 PayAnte, int32 PayRaise, int32 PayProgressive,
                    	int32 PayMultiBank, int32 Outcome, int32 BalAdjust, int32 *Balance, 
                        bool8 bMalfunction, CGame *pGame)
{
	int32 result = TrackSQL::ExecFailed;
	int32 comp;

	if (m_pTracker && m_pInfo)
	{
		m_pTracker->lock();

        CDrawGame *pDraw =  (CDrawGame *) pGame;

		result = gameDone(ServerOpts::casinoId,
			m_pInfo->pid, m_pInfo->forMoney, m_pInfo->gid,
			Raised, PayAnte, PayRaise, PayProgressive, PayMultiBank, 
            Outcome, BalAdjust, Balance, &comp, bMalfunction,           
            pDraw->getOriginalDealerHand()->getCount(), pDraw->getOriginalDealerHand()->getCards(), 
            pDraw->getDealerHand()->getCount(), pDraw->getDealerHand()->getCards(), 
            pDraw->getPlayerHand()->getCount(), pDraw->getPlayerHand()->getCards(),
            (uint8) pDraw->getDealerDraw()->getCount(), (uint8) pDraw->getPlayerDraw()->getCount()); 

		m_pTracker->unlock();
	}

	return (bool8)(result == TrackSQL::NoError);
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackHasSavedGame(CPokerConnection *pConn, CGame ** ppGame, int32 * err)
///
/// Checks for unfinished Caribbean Draw games that this player might have laying around and if one is
/// found, returns the state information to the caller so that the game can be reincarnated.
///
/// @param  pConn       this method may create a new Draw game, and this is needed if it does
/// @param  ppGame      pointer to new Draw game, IF one is created.
/// @param  err         if something goes wrong, the value returned should give some idea of what
///
/// @return bool8       true if a game was re-created successfully.  false otherwise.
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackHasSavedGame(CPokerConnection *pConn, CGame ** ppGame, int32 * err)
{
	CSavedGame sg;
	bool8 exists;
	int32 result = TrackSQL::ExecFailed;

	if (m_pTracker && m_pInfo)
	{
		m_pTracker->lock();

		result = hasSavedGame(m_pInfo->pid, m_pInfo->forMoney,
			                  m_pInfo->gid, &sg, &exists);

		if (result == TrackSQL::NoError)
		{
			if (exists)
			{
				*ppGame = new CDrawGame(pConn, &sg);
			}
			else
			{
				memset(m_pInfo->gid, 0xff, sizeof(CPokerGameID));
			}
		}

		m_pTracker->unlock();
	}

	if (*ppGame && !(*ppGame)->isGameOK())
		*err = LOGINERR_CONTACTCUSTSERVICE;
	else if (result != TrackSQL::NoError)
		*err = LOGINERR_TRYLATER;
	else
		*err = 0;

	return (bool8)((result == TrackSQL::NoError) && *ppGame && (*ppGame)->isGameOK());
}



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackSaveGame(CGame *pGame)
///
/// Doesn't actually do anything.  Just a place holder.
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackSaveGame(CGame *pGame)
{
	CSavedGame sg;
	int32 result = TrackSQL::ExecFailed;

	if (!pGame)
		return true;

	if (m_pTracker && m_pInfo)
	{
		pGame->save(&sg);

		m_pTracker->lock();
		result = saveGame(m_pInfo->pid, m_pInfo->forMoney, m_pInfo->gid, &sg);
		m_pTracker->unlock();

		return (bool8)(result == TrackSQL::NoError);
	}
	return false;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     CDrawSQL::trackGetOptions(bool8* progressiveOn, uint8* progPayTable, 
///                            int32* progJackpotID, uint8* payTable)
///
/// Returns the specific setup options that the casino has selected for Caribbean Draw.
///
/// @param  progressiveOn       (out) enable progressive?
/// @param  progPayTable        (out) which set of payout numbers to use for progressive wins?
/// @param  progJackpotID       (out) 
/// @param  payTable            (out) which set of payout numbers should be used for normal wins?
///
/// @return int32           TrackSQL::NoError on success, TrackSQL::ExecFailed on failure
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bool8
CDrawSQL::trackGetOptions(bool8* progressiveOn, uint8* progPayTable, int32* progJackpotID, uint8* payTable, int32* progressiveFixAmountMultiplier)
{
    int32 result = TrackSQL::ExecFailed;

	if (m_pTracker)
	{
		m_pTracker->lock();
		result = getOptions(progressiveOn, progPayTable, progJackpotID, payTable, progressiveFixAmountMultiplier);
		m_pTracker->unlock();
	}

	if (result == TrackSQL::NoError)
    {
		return true;
    }

	return false;
}

